﻿using System;
using System.ComponentModel;

namespace Borg
{
    [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
    public class ExtensionAttribute : Attribute
    {
        [CodeSupportDescription(Accelerator = '1', Group = "Event", MethodPostFix = "_Created", Order = 1)]
        public string OnCreated = string.Empty;

        [CodeSupportDescription(Accelerator = '2', Group = "Event", MethodPostFix = "_Releasing", Order = 2)]
        public string OnReleasing = string.Empty;

        [CodeSupportDescription(Accelerator = '3', Group = "Event", MethodPostFix = "_Released", Order = 3)]
        public string OnReleased = string.Empty;

        public string Name;

        [DefaultValue(typeof(bool), "false")]
        [CodeSupportDescription(Accelerator = 'R', Group = "Property", Order = 1)]
        public bool Singleton;

        [CodeSupportDescription(Accelerator = 'I', Group = "Property", Order = 2)]
        [DefaultValue(typeof(bool), "true")]
        public bool AutoRelease;

        public ExtensionAttribute()
        {
            AutoRelease = true;
        }

        public ExtensionAttribute(string name)
            : this()
        {
            Name = name;
        }
    }
}

